package com.txtTool.articleTxt.controller.pageManger;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * @Author : XingLZ
 * @Description :
 * @Data : Create at 15:45 2019-05-11
 * @Modify By :
 */
@Controller
@RequestMapping(value="")
public class HomeController {

    /**
     * 只输入ip的默认页面
     * @return
     */
    @GetMapping(value = "/")
    public ModelAndView index() {
        ModelAndView mv = new ModelAndView("welcome");
        return mv;
    }

    @GetMapping(value = "/center/{page}")
    public ModelAndView center(@PathVariable("page") String page) {
        String[] li = page.split(":");
        if(li.length>1){
            page = page.replaceAll(":","/");
        }
        ModelAndView mv = new ModelAndView("center/"+page);
        return mv;
    }

}
